package com.cloudkinto.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.cloudkinto.enumType.order.outbound.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 出库单
 * </p>
 *
 * @author long
 * @since 2024-11-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_order_outbound")
public class OrderOutboundDo extends Model<OrderOutboundDo> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 推送到代理仓 0 不需要推送 1 未推送 2 已推送 3 推送失败 4 单号获取成功
     */
    @TableField("send_out")
    private Integer sendOut;

    /**
     * 推送失败原因
     */
    @TableField("send_out_fail_msg")
    private String sendOutFailMsg;

    /**
     * 租户id
     */
    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    private Long tenantId;

    /**
     * 仓库id
     */
    @TableField(value = "wh_id", fill = FieldFill.INSERT)
    private Long whId;

    /**
     * 店铺id
     */
    @TableField("store_id")
    private Long storeId;

    /**
     * 客户id
     */
    @TableField(value = "company_id", fill = FieldFill.INSERT)
    private Long companyId;

    @TableField(value = "wave_id")
    private Long waveId;

    /**
     * 出库单号
     */
    @TableField("outbound_no")
    private String outboundNo;

    /**
     * 订单类型 {@link OutboundTypeEnum}
     */
    @TableField("order_type")
    private Integer orderType;

    /**
     * 订单品种类型 {@link OutboundVarietyTypeEnum}
     */
    @TableField("order_variety_type")
    private Integer orderVarietyType;

    /**
     * 订单来源 {@link OutboundOriginEnum}
     */
    @TableField("order_origin")
    private Integer orderOrigin;

    /**
     * 目的地类型 {@link DestinationTypeEnum}
     */
    @TableField("destination_type")
    private Integer destinationType;

    /**
     * 出库方式 1按产品出库 2按箱出库
     */
    @TableField("outbound_mode")
    private Integer outboundMode;

    /**
     * FBA装运ID
     */
    @TableField("fba_shipment_id")
    private String fbaShipmentId;

    /**
     * 货件追踪码
     */
    @TableField("shipment_tracking_code")
    private String shipmentTrackingCode;

    /**
     * 出货托盘数
     */
    @TableField("outbound_pallets_num")
    private Integer outboundPalletsNum;

    /**
     * 物流渠道id
     */
    @TableField("logistics_channel_id")
    private Long logisticsChannelId;

    /**
     * 承运商代码
     */
    @TableField("carrier")
    private String carrier;

    /**
     * 面单文件
     */
    @TableField("label_file_id")
    private Long labelFileId;

    /**
     * {@link NormalOutboundStatusEnum}
     * {@link TransferOutboundStatusEnum}
     */
    @TableField("status")
    private Integer status;

    /**
     * 物流跟踪号
     */
    @TableField("tracking_number")
    private String trackingNumber;

    /**
     * 销售平台 {@link SalesPlatformEnum}
     */
    @TableField("sales_platform")
    private Integer salesPlatform;

    /**
     * 平台单号
     */
    @TableField("platform_order_no")
    private String platformOrderNo;

    /**
     * 参考单号
     */
    @TableField("reference_number")
    private String referenceNumber;

    /**
     * 签名服务 {@link OutboundSignServiceEnum}
     */
    @TableField("signature_service")
    private Integer signatureService;

    /**
     * 是否要求保险
     */
    @TableField("insurance_flag")
    private Boolean insuranceFlag;

    /**
     * 保险金额
     */
    @TableField("insure_money")
    private BigDecimal insureMoney;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 备注
     */
    @TableField("remark2")
    private String remark2;

    /**
     * 总数
     */
    @TableField("total_num")
    private Integer totalNum;

    /**
     * 包裹数
     */
    @TableField("package_num")
    private Integer packageNum;

    /**
     * 收件人
     */
    @TableField("receiver")
    private String receiver;

    /**
     * 电话
     */
    @TableField("phone")
    private String phone;

    /**
     * 邮箱
     */
    @TableField("email")
    private String email;

    /**
     * 收件人税号
     */
    @TableField("tax_num")
    private String taxNum;

    /**
     * 公司名称
     */
    @TableField("company_name")
    private String companyName;

    /**
     * 国家地区二字码
     */
    @TableField("country_region_code")
    private String countryRegionCode;

    /**
     * 省/州
     */
    @TableField("province_name")
    private String provinceName;

    /**
     * 城市名称
     */
    @TableField("city_name")
    private String cityName;

    /**
     * 邮编
     */
    @TableField("post_code")
    private String postCode;

    /**
     * 门牌号
     */
    @TableField("house_num")
    private String houseNum;

    /**
     * 地址1
     */
    @TableField("address1")
    private String address1;

    /**
     * 地址2
     */
    @TableField("address2")
    private String address2;

    /**
     * 附件
     */
    @TableField("appendix_ids")
    private String appendixIds;

    /**
     * 面单打印时间
     */
    @TableField("face_sheet_print_time")
    private Date faceSheetPrintTime;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 提交时间
     */
    @TableField("push_wms_time")
    private Date pushWmsTime;

    /**
     * 生成波次时间
     */
    @TableField("create_wave_time")
    private Date createWaveTime;

    /**
     * 拣货时间
     */
    @TableField("picking_time")
    private Date pickingTime;

    /**
     * 复核时间
     */
    @TableField("recheck_time")
    private Date recheckTime;

    /**
     * 称重时间
     */
    @TableField("weigh_time")
    private Date weighTime;

    /**
     * 出库时间
     */
    @TableField("outbound_time")
    private Date outboundTime;

    /**
     * 取消事件
     */
    @TableField("cancel_time")
    private Date cancelTime;

    @TableField("exception_time")
    private Date exceptionTime;

    @TableField("mark_exception_time")
    private Date markExceptionTime;

    @TableField("exception_reason")
    private String exceptionReason;

    //todo 后面做成枚举
    @TableField("exception_type")
    private String exceptionType;

    @TableField("interception_flag")
    private Boolean interceptionFlag;

    @TableField("reserve_flag")
    private Integer reserveFlag;

    /**
     * 下单时间
     */
    @TableField("order_time")
    private Date orderTime;

    @TableField("delivery_date")
    private String deliveryDate;

    @TableField("delivery_time_name")
    private String deliveryTimeName;
    /**
     * 预约开始时间
     */
    private Date reserveBeginTime;

    /**
     * 预约结束时间
     */
    private Date reserveEndTime;

    /**
     * 最新状态
     */
    private String latestStatus;

    /**
     * 轨迹更新时间
     */
    private Date traceUpdateTime;

    /**
     * 妥投时间
     */
    private Date deliveryConfirmationTime;

    /**
     * 运输天数
     */
    private Integer transportDays;

    /**
     * 公司标签
     */
    private String companyTag;

    /**
     * 自定义渠道名
     */
    private String customizeChannelName;

    private String skuDetail;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
